--[[
FilePath: \Lua\View\UIHeroCollect\UIHeroCollectTips.lua
英雄集结奖励提示框
--]]

require 'View/UIBase/UIBase'

UIHeroCollectTips = UIBase.New(PanelResNames.UIHeroCollectTips)
local _M = UIHeroCollectTips

_M.hasInit = false

function _M.Init()
    --self.heroId = heroId;
    UIBase.Init(_M)
end

-- 创建回调
function _M:OnCreate()
    if not _M.hasInit then
        _M.hasInit = true
        self.btnBgClose = self:GetChild("close");
        self.title = self:GetChild("name")
        self.desc = self:GetChild("Desc")
        self.desc1 = self:GetChild("Desc1")
        self.desc2 = self:GetChild("Desc2")

        self:showLanguage()
        self:addEvent()
        --self:ShowIcon()
    end
end

function _M:showLanguage()
    --self.title.text = getLanguage("Activitytitle10501");
    self.desc.text = getLanguage("ActivityDesc1050101");
    self.desc1.text = getLanguage("ActivityDesc1050102");
    self.desc2.text = getLanguage("ActivityDesc1050103");
end

function _M:addEvent()
    self.btnBgClose.onClick:Add(self.OnClose)
end

--[[
function _M:ShowIcon()
    if self.heroId ~= nil then
        return;
    end
    local cfg = G.dataTable["t_hero"][tostring(self.heroId)];
    if cfg ~= nil then
        if AppConst.drawingState == 0 then
            --普通模式
            self.imgIcon.url = "ui://HalfBodyAtlas/" .. cfg.f_HeroBIcon
        else
            --和谐模式
            self.imgIcon.url = "ui://HalfBodyAtlas/" .. cfg.f_HeroBIconPA
        end
    end
end
--]]

function _M:removeEvent()
    self.btnBgClose.onClick:Remove(self.OnClose)
end

function _M.OnClose()
    closeUI(PanelResNames.UIHeroCollectTips);
end

function _M:OnEnable()
end

function _M:OnDisable()
end

function _M:OnDestroy()
    self:removeEvent();
    _M.hasInit = false;
end

return _M;
